package demo3;
class Student {
    public String name;
    public double score;
    public int age;
    public static String classes = "21软件工程";
//    静态成员变量，不属于对象
    //加上final表示为常量不能被修改

    public Student(String name, double score, int age) {
        this.name = name;
        this.score = score;
        this.age = age;
    }

    {
        System.out.println("实例代码块");
    }
    static{
        classes = "20软件工程";
        System.out.println("静态代码块");
    }
    //执行顺序静态，实例，构造......

    public static void staticFunc( ){
        System.out.println("这是一个静态的方法——》类方法");
    }
}
public class Test3 {
    public static void main(String[] args) {
        Student student = new Student("zijan",100,19);
        System.out.println(Student.classes);
        //静态成员变量最好通过类名去访问，不需要对象，为类的属性
        Student student1 = new Student("gaobo",59,28);
        System.out.println(Student.classes);
    }
}
